////////////////////////////////////////////////////////////////////////
//
// BEGIN_COPYRIGHT
// Confidential property of Faxsun.
//
// Copyright 2014-
//
// Faxsun. All rights reserved.
//
// Unpublished rights reserved under Chinese copyright laws.
// END_COPYRIGHT
//
// BEGIN_DISCLAIMER
// This software contains confidential and trade secret information of 
// Faxsun. Use, duplication or disclosure of the software and 
// documentation by any individual, organization or government must be 
// granted written agreement from Faxsun.
//
// Faxsun. Shanghai China
// END_DISCLAIMER
//
////////////////////////////////////////////////////////////////////////
package com.faxsun.web.utils;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import com.alibaba.fastjson.JSON;
import com.faxsun.http.HttpInvoker;
import com.faxsun.web.pojos.WechatUserInfo;

/**
 * 微信公众号接口调用辅助类
 * 
 * @author bowen.sun
 *
 */
@Component("wechatApiUtils")
public class WechatApiUtils {

	@Value("${account.wechat.info.url}")
	private String WechatUserInfoUrl;

	/**
	 * 获取用户信息
	 * 
	 * @param openId
	 * @return
	 */
	public WechatUserInfo getUserInfo(String openId) {
		String resultStr = HttpInvoker.get(WechatUserInfoUrl + "?openId=" + openId);
		return JSON.parseObject(resultStr, WechatUserInfo.class);
	}

}
